/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.hera.process.workflow.domain;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.TableGenerator;
import javax.persistence.Transient;

import com.hera.base.domain.BaseDomain;
import com.hera.process.form.domain.DynaformStage;

/**
 *
 * @author cmontes
 */
@Entity
public class Stage extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "Stage")
    @TableGenerator(name = "Stage", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_id", pkColumnValue = "STAGE", allocationSize = 1)
    @Column(name = "ID_STAGE")
    private Long idStage;
    private String name;
    private String description;
    @Column(name = "TIME_AMOUT")
    private Double timeAmout;
    @Column(name = "ID_TIMEUNIT")
    private Long idTimeunit;
    @Column(name = "ID_TYPE")
    private Long idType;
    private Integer secuence;
    @JoinColumns({
        @JoinColumn(name = "ID_PROCESS", referencedColumnName = "ID_PROCESS"),
        @JoinColumn(name = "ID_DEPARTMENT", referencedColumnName = "ID_DEPARTMENT")})
    @ManyToOne
    private Swimlane swimlane;
    //@OneToMany(mappedBy = "stage")
    @Transient
    private List<StageUser> stageUserList;
    //@OneToMany(cascade = CascadeType.ALL, mappedBy = "stage")
    @Transient
    private List<DynaformStage> dynaformStageList;
    //@OneToMany(cascade = CascadeType.ALL, mappedBy = "stage")
    @Transient
    private List<StageRollup> stageRollupList;
    //@OneToMany(cascade = CascadeType.ALL, mappedBy = "stage1")
    @Transient
    private List<StageRollup> stageRollupList1;
    
    @Column(name = "REFERENCE_DIAGRAM")
    private String referenceDiagram;
    
    @Column(name = "ID_FIGURE")
    private String idFigure;
    
    @Column(name = "ID_PROCESS", insertable=false,updatable=false)
    private Long idProcess;

    public Stage() {
    }

    public Stage(Long idStage) {
        this.idStage = idStage;
    }

    public Long getIdStage() {
        return idStage;
    }

    public void setIdStage(Long idStage) {
        this.idStage = idStage;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Double getTimeAmout() {
        return timeAmout;
    }

    public void setTimeAmout(Double timeAmout) {
        this.timeAmout = timeAmout;
    }

    public Long getIdTimeunit() {
        return idTimeunit;
    }

    public void setIdTimeunit(Long idTimeunit) {
        this.idTimeunit = idTimeunit;
    }

    public Long getIdType() {
        return idType;
    }

    public void setIdType(Long idType) {
        this.idType = idType;
    }

    public Integer getSecuence() {
        return secuence;
    }

    public void setSecuence(Integer secuence) {
        this.secuence = secuence;
    }

    public Swimlane getSwimlane() {
        return swimlane;
    }

    public void setSwimlane(Swimlane swimlane) {
        this.swimlane = swimlane;
    }

    public List<StageUser> getStageUserList() {
        return stageUserList;
    }

    public void setStageUserList(List<StageUser> stageUserList) {
        this.stageUserList = stageUserList;
    }

    public List<DynaformStage> getDynaformStageList() {
        return dynaformStageList;
    }

    public void setDynaformStageList(List<DynaformStage> dynaformStageList) {
        this.dynaformStageList = dynaformStageList;
    }

    public List<StageRollup> getStageRollupList() {
        return stageRollupList;
    }

    public void setStageRollupList(List<StageRollup> stageRollupList) {
        this.stageRollupList = stageRollupList;
    }

    public List<StageRollup> getStageRollupList1() {
        return stageRollupList1;
    }

    public void setStageRollupList1(List<StageRollup> stageRollupList1) {
        this.stageRollupList1 = stageRollupList1;
    }
    
    public String getReferenceDiagram() {
		return referenceDiagram;
	}

	public void setReferenceDiagram(String referenceDiagram) {
		this.referenceDiagram = referenceDiagram;
	}
	
	public String getIdFigure() {
		return idFigure;
	}

	public void setIdFigure(String idFigure) {
		this.idFigure = idFigure;
	}

	public Long getIdProcess() {
		return idProcess;
	}

	public void setIdProcess(Long idProcess) {
		this.idProcess = idProcess;
	}

	@Override
    public int hashCode() {
        int hash = 0;
        hash += (idStage != null ? idStage.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof Stage)) {
            return false;
        }
        Stage other = (Stage) object;
        if ((this.idStage == null && other.idStage != null) || (this.idStage != null && !this.idStage.equals(other.idStage))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.hera.process.data.domain2.Stage[ idStage=" + idStage + " ]";
    }
    
}
